<!--
 * @Author: error: git config user.name && git config user.email & please set dead value or install git
 * @Date: 2023-01-05 11:32:58
 * @LastEditors: 朱安武 549410045@qq.com
 * @LastEditTime: 2023-01-05 20:27:18
 * @FilePath: \elementUi\src\components\EditorMain.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <textarea id="editor"></textarea>
    <el-button @click="reset" class="btn">重置</el-button>
    <el-button @click="submit" class="btn">提交</el-button>
</template>

<script setup>
import { onMounted } from 'vue'


onMounted(() => {
    //tinymce 创建
    tinymce.init({
        //绑定标签
        selector:'#editor',
        //语言包
        language:'zh-Hans',
        //去右上角广告
        promotion:false,
        //去右下角广告
        branding:false,
        //去掉状态栏
        statusbar:false,
        //配置插件
        plugins: 'table image fullscreen preview'
    })
})

//提交
const submit = ()=>{
    console.log(tinymce.activeEditor.getContent())
    //清空文本
    tinymce.activeEditor.setContent("")
}

//重置
const reset = ()=>{
    tinymce.activeEditor.setContent("")
}
</script>

<style scoped>
.btn {
    margin-top: 10px;
    margin-right: 20px;
    float: right;
}
</style>